package com.ay.weixin.fdc.front.scratchcard.db;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

import lizar.db.ibatis.Dao;

import com.ay.weixin.fdc.front.scratchcard.domain.UserScratchInfo;

public class UserScratchInfoDao extends Dao{
	
	
	public UserScratchInfo getByOpenId(String openid,long scratchcard_id) throws SQLException{
		Map<String,Object> args=new HashMap<String,Object>();
		args.put("openid", openid);
		args.put("scratchcard_id", scratchcard_id);
		return (UserScratchInfo)this.sqlMapper.queryForObject("user_scratch_info.getByOpenId",args);
	}
	
	public UserScratchInfo get(long id) throws SQLException{
		return (UserScratchInfo)this.sqlMapper.queryForObject("user_scratch_info.get",id);
	}
	
	public void insert(UserScratchInfo user_scratch_info) throws SQLException{
		
		
		this.sqlMapper.insert("user_scratch_info.insert",user_scratch_info);
		
	}
	
	public void imc_scratch(long user_info_id,long reward_id) throws SQLException{
		Map<String,Object> args=new HashMap<String,Object>();
		args.put("id", user_info_id);
		args.put("reward_id", reward_id);
		
		this.sqlMapper.update("user_scratch_info.imc_scratch",args);
	}
	
}
